﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.3.20    立项申请调查报告调查对象信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_APP_PROCHECKOBJINFO: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_APP_PROCHECKOBJINFO()
		{}
		#region Model
		private long _id;
		private long _reginfoid;
		private long _proid;
		private long _reportid;
		private string _surveyobj;
		private Nullable<DateTime> _surveytime;
		private string _ownersurveyby;
		private string _countby;
		private string _countbyind;
		private int _sparefield1;
		private string _sparefield2;
		private string _sparefield3;
		/// <summary>
		/// 主键ID主键ID，唯一
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 申请登记记录ID
		/// </summary>
		[DataMember]
		public long REGINFOID
		{
			get{return _reginfoid;}
			set{
				if ( _reginfoid!= value)
				{
					 _reginfoid = value;
					OnPropertyChanged("REGINFOID");
				}
			}
		}
		/// <summary>
		/// 立项申请记录ID
		/// </summary>
		[DataMember]
		public long PROID
		{
			get{return _proid;}
			set{
				if ( _proid!= value)
				{
					 _proid = value;
					OnPropertyChanged("PROID");
				}
			}
		}
		/// <summary>
		/// 立项申请调查报告主表记录IDTb_App_ProReportInfo.ID
		/// </summary>
		[DataMember]
		public long REPORTID
		{
			get{return _reportid;}
			set{
				if ( _reportid!= value)
				{
					 _reportid = value;
					OnPropertyChanged("REPORTID");
				}
			}
		}
		/// <summary>
		/// 调查对象
		/// </summary>
		[DataMember]
		public string SURVEYOBJ
		{
			get{return _surveyobj;}
			set{
				if ( _surveyobj!= value)
				{
					 _surveyobj = value;
					OnPropertyChanged("SURVEYOBJ");
				}
			}
		}
		/// <summary>
		/// 调查时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> SURVEYTIME
		{
			get{return _surveytime;}
			set{
				if ( _surveytime!= value)
				{
					 _surveytime = value;
					OnPropertyChanged("SURVEYTIME");
				}
			}
		}
		/// <summary>
		/// 我司参与调查人员
		/// </summary>
		[DataMember]
		public string OWNERSURVEYBY
		{
			get{return _ownersurveyby;}
			set{
				if ( _ownersurveyby!= value)
				{
					 _ownersurveyby = value;
					OnPropertyChanged("OWNERSURVEYBY");
				}
			}
		}
		/// <summary>
		/// 对方接待人员
		/// </summary>
		[DataMember]
		public string COUNTBY
		{
			get{return _countby;}
			set{
				if ( _countby!= value)
				{
					 _countby = value;
					OnPropertyChanged("COUNTBY");
				}
			}
		}
		/// <summary>
		/// 对方接待人员身份
		/// </summary>
		[DataMember]
		public string COUNTBYIND
		{
			get{return _countbyind;}
			set{
				if ( _countbyind!= value)
				{
					 _countbyind = value;
					OnPropertyChanged("COUNTBYIND");
				}
			}
		}
		/// <summary>
		/// 预留字段1
		/// </summary>
		[DataMember]
		public int SPAREFIELD1
		{
			get{return _sparefield1;}
			set{
				if ( _sparefield1!= value)
				{
					 _sparefield1 = value;
					OnPropertyChanged("SPAREFIELD1");
				}
			}
		}
		/// <summary>
		/// 预留字段2
		/// </summary>
		[DataMember]
		public string SPAREFIELD2
		{
			get{return _sparefield2;}
			set{
				if ( _sparefield2!= value)
				{
					 _sparefield2 = value;
					OnPropertyChanged("SPAREFIELD2");
				}
			}
		}
		/// <summary>
		/// 预留字段3
		/// </summary>
		[DataMember]
		public string SPAREFIELD3
		{
			get{return _sparefield3;}
			set{
				if ( _sparefield3!= value)
				{
					 _sparefield3 = value;
					OnPropertyChanged("SPAREFIELD3");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

